<?php
class RegisterForm extends sfGuardUserForm
{
  public function configure()
  {
    // Remove all widgets we don't want to show
    unset(
      $this['is_active'],
      $this['is_super_admin'],
      $this['updated_at'],
      $this['groups_list'],
      $this['permissions_list'],
      $this['last_login'],
      $this['created_at'],
      $this['salt'],
      $this['algorithm'],
	  $this['password_confirmation']
    );
 
	$this->validatorSchema['username'] = new sfValidatorString(array('required' => true),array('required'=>'Vous avez besoin d\'un nom d\'usuaire ou identifiant, si c\'est un &eacute;mail encore mieux! On vous envoie par &eacute;mail le mot de passe pour vous en souvenir'));
	$this->validatorSchema['password'] = new sfValidatorString(array('required' => true),array('required'=>'Tapez votre mot de passe, facile &agrave; memoriser!'));
  	
    $this->widgetSchema->setLabel('username', 'Identifiant');
    // Setup proper password validation with confirmation
    $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
    $this->validatorSchema['password']->setOption('required', true);
	$this->widgetSchema->setLabel('password', 'Mot de passe');
    //$this->widgetSchema['password_confirmation'] = new sfWidgetFormInputPassword();
    //$this->validatorSchema['password_confirmation'] = clone $this->validatorSchema['password'];
	$this->setWidget('sendEmail', new sfWidgetFormInputCheckbox());
	$this->widgetSchema->setLabel('sendEmail', 'Envoyer un &eacute;mail de rappel du mot de passe<div style="margin-left:17px;">(seulement si votre identifiant est une addresse &eacute;mail)</div>');
    $this->validatorSchema['sendEmail'] = new sfValidatorString(array('required' => false));
 
    //$this->widgetSchema->moveField('password_confirmation', 'after', 'password');
 
    //$this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_confirmation', array(), array('invalid' => 'The two passwords must be the same.')));
  }
}
?>